package com.freight.base.utils;

public class PasswordUtils {
    /**
     * 包含大小写字母及数字且在6-12位
     * 是否包含
     *
     * @param str
     * @return
     */
    public static final String PW_PATTERN =
            "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[~!@#$%^&*()_+`\\-={}:\";'<>,.\\/]).{8,16}";
    public static boolean isRightPass(String str) {
        return   str.matches(PW_PATTERN);
    }
    public static final String NEW_PATTERN =
            "^(?=.*[a-zA-Z])(?=.*\\d).{6,20}";
    public static boolean isRightNewPass(String str) {
        return   str.matches(NEW_PATTERN);
    }
    public static void main(String[] args){

        String pw13 = "ABCDEabcde!@#$%";
        String pw14 = "ABCDEabcde01234";
        String pw15 = "Aa0!";
        //符合要求密码
        String pw16="111111a";
        //符合要求密码
        String pw17="aA123456.&8";
        System.out.println(isRightNewPass(pw16));
        System.out.println(isRightNewPass(pw17));
    }
}
